{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "导入numpy包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import random as r"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "导入numpy中的random。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.75525833, 0.06350871, 0.06237795, 0.7518237 , 0.3204412 ,\n",
       "       0.16935966, 0.61252396, 0.34915702, 0.74730149, 0.34674222,\n",
       "       0.6264661 , 0.64534075, 0.24562979, 0.75876073, 0.52676505,\n",
       "       0.02195203, 0.76111686, 0.84757174, 0.17931121, 0.94873716])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.random(20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "random方法，参数为要生成的随机数的个数，无约束条件。（只能有一个参数）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr3=list(map(np.int,4*r.randn(1000)))\n",
    "arr4=list(map(np.int,4*r.randn(1000)))\n",
    "arr3.sort()\n",
    "arr4.sort()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "randn方法，参数为数组的行和列。返回的是服从正态分布的随机数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[3, 1, 7, 9, 12, 25, 35, 77, 72, 71, 97, 169, 95, 92, 72, 43, 48, 24, 24, 12, 8, 3, 1] [3, 4, 8, 12, 12, 30, 47, 59, 67, 89, 89, 200, 98, 80, 61, 49, 44, 23, 11, 7, 4, 2, 1]\n",
      "200\n"
     ]
    }
   ],
   "source": [
    "min1=min(arr3[0],arr4[0])\n",
    "max1=max(arr3[-1],arr4[-1])+1\n",
    "arr3_,arr4_=[],[]\n",
    "for i in range(min1,max1):\n",
    "    try:\n",
    "        arr3_.append(arr3.count(i))\n",
    "    except:\n",
    "        arr3_.append(0)\n",
    "for i in range(min1,max1):\n",
    "    try:\n",
    "        arr4_.append(arr4.count(i))\n",
    "    except:\n",
    "        arr4_.append(0)\n",
    "print(arr3_,arr4_)\n",
    "top=max(max(arr3_),max(arr4_))\n",
    "print(top)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEfCAYAAABSy/GnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3X9clGW+//HXgBgSAoqIpmhqbpm/NnUfrlb+QnSzNRSoyS031tTc7FHqIdtS81tabrbuI89Wbh3t7KnWcsHQrHVrMyqzHyvQ0hhLh8WQnB0ZIBRHxpFh5vsHh9mQH3OjwKC+n/+MzFzXdX8uZ+A9933dc4/JYrF4ERER8SMo0AWIiMiFQYEhIiKGKDBERMQQBYaIiBiiwBAREUMUGCIiYogCQ0REDFFgiJyjRx55hMmTJ1NdXR3oUnyefPJJJk6cSGVlZaBLkYuQAkMuSSNHjmTkyJHMmDEDl8vVZJuZM2cycuRI3G53o8e++uor3nrrLRYsWEBYWFiL2/r973/v296nn37aqjrfeOMNHnvsMX72s5/xox/9iJEjR/Kf//mfzbZfvHgxNTU1PP/8863ajogRCgy5pNlsNl555ZVW99u8eTPh4eGYzeYW2+Xn5/PCCy/4DZXm/OY3vyEjI4MjR44QExPjt32vXr1ITEwkIyMDm812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PDCC4bm2FZ0Wq2IiBiiRW8RETFEgSEiIoYoMERExBAFhoiIGKLAEBERQxQYIiJiiAJDREQMUWCIiIghCgyRdvLdd98xderUBl8a9fXXXzN27FhDXwol0tkoMETaSc+ePVm/fj0vvvgif//73zl9+jQPPfQQN910k6GrqIp0Nro0iEg7e+qpp8jKymLcuHHk5uaSkZFh+BpeIp2JAkOknZ05c4bk5GRKSkp45ZVXDH1BkUhnpENSIu3MarVSWlqKyWTi6NGjgS5H5JxpD0OkHdXU1HDnnXcycOBARo4cyZYtW9i5c6fvu9FFLiTawxBpR88++yzfffcdq1ev5s4772TUqFE8/PDDeDyeQJcm0moKDJF2cvDgQV5++WWefPJJIiIiMJlMrF+/nm+++YaXXnop0OWJtJoOSYmIiCHawxAREUMUGCIiYogCQ0REDFFgiIiIIQoMERExRIEhIiKGKDBERMQQBYaIiBjy/wGHp6qYlMFulQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as mp\n",
    "X = np.array(arr3_)\n",
    "Y = np.array(arr4_)\n",
    "mp.figure('Bar'  , facecolor='lightgray')\n",
    "mp.title('N(4,1)', fontsize=20)\n",
    "mp.xlabel('x', fontsize=14)\n",
    "mp.ylabel('y', fontsize=14)\n",
    "mp.tick_params(labelsize=10)\n",
    "mp.grid(axis='y', linestyle=':')\n",
    "mp.ylim((0, (top//10+1)*10))\n",
    "x = np.arange(min1,max1)\n",
    "mp.bar(x-0.3, X, 0.6, color='dodgerblue',label='1')\n",
    "mp.bar(x + 0.3, Y, 0.6, color='orangered',label='2', alpha=0.75)\n",
    "mp.xticks(x, [str(i) for i in range(min1,max1)])\n",
    "mp.legend()\n",
    "mp.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "正态分布"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.22690315, 0.2085321 ])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.rand(2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "rand可以只传一个参数。（所以为啥random不行。。）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr3=list(map(np.int,4*r.rand(1000)))\n",
    "arr4=list(map(np.int,4*r.rand(1000)))\n",
    "arr3.sort()\n",
    "arr4.sort()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "rand方法，参数为数组的行和列。返回的是服从均匀分布的随机数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[261, 241, 241, 257] [246, 244, 230, 280]\n",
      "280\n"
     ]
    }
   ],
   "source": [
    "min1=min(arr3[0],arr4[0])\n",
    "max1=max(arr3[-1],arr4[-1])+1\n",
    "arr3_,arr4_=[],[]\n",
    "for i in range(min1,max1):\n",
    "    try:\n",
    "        arr3_.append(arr3.count(i))\n",
    "    except:\n",
    "        arr3_.append(0)\n",
    "for i in range(min1,max1):\n",
    "    try:\n",
    "        arr4_.append(arr4.count(i))\n",
    "    except:\n",
    "        arr4_.append(0)\n",
    "print(arr3_,arr4_)\n",
    "top=max(max(arr3_),max(arr4_))\n",
    "print(top)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEfCAYAAABSy/GnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREF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oHmhHHcSEymNSKWpuRptIdYaZg6D4/FQn16x/tU992ONurTl+GxWGiYOs8r+57JOlWHJuCIGIc9Kplaaywl8dP6tO+1RCfgGp9GmzWcxrR03H7+XJ+1qMf95vr0DNyBwTSmzBzwz1NP+95Af576c9+rDk3o1fdeYWEhLpcLUxabzeYxnrofNDU1kZuby5YtW1iyZAlz587l/PnzneNv/vz973+fTZs2MWPGDAA2bdrE9u3bSU1NvWXbubm5XLx4sVd1jX2tV7N5Tdm1hYO+zE8+6918D8/J699CDAyn7QPaRrdzt2yfPvlp77dRamoqhw8fvu10g9rDaG1tZfv27axatYolS5YAEBkZ2XmoqaqqisjISKCjR1FRUdE5b2VlJTExMYNZroiI/I1BCwyPx8OePXsYN24cGzZs6By+YMECTpw4AcCJEydYuLAj1RcuXMh7772Hx+OhoKAAq9XaeehKREQGn99gLejy5cu8//77TJw4kezsbAC2bdvGU089xY4dOzh27Bjx8fHs27cPgPvvv58zZ86QmZlJUFCQrpISEfGyQQuMGTNmYLPZehx34MCBbsMsFgs7d+4c6LJERMSQ7vQWEREjCgwRETGiwBARESMKDBERMaLAEBERIwoMERExosAQEREjCgwRETGiwBARESMKDBERMaLAEBERIwoMERExosAQEREjCgwRETGiwBARESMKDBERMaLAEBERIwoMERExosAQEREjCgwRETGiwBARESMKDBERMaLAEBERIwoMERExosAQEREjCgwRETGiwBARESMKDBERMTJogbFr1y7mz5/PmjVrOoe9/vrrLF68mOzsbLKzszlz5kznuAMHDpCZmcnq1as5d+7cYJUpIiK34DdYC8rKyuKRRx7hpZde6jL88ccfJzc3t8uwkpISTp06xfHjx3E6nWzevJkPPvgAX1/fwSpXRES+YtB6GLNmzSIsLMxo2ry8PFauXElAQACjR48mMTERm802wBWKiMjX8fo5jEOHDrF27Vp27dpFXV0dAJWVlcTGxnZOExsbi9Pp7HH+I0eOkJOTQ05ODg6Hg+rqahwOB3a7ndraWkpKSnC5XBQWFuJ2u8nPzwfg0qVLAOTn5+N2u1kdXki4r4uMkSUkB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XevtsoaMy5cv8/777zNx4sTOR19s27aNjIwML1c2dFRVVbFz507a29vxeDwsW7aM+fPne7usIUGX1YqIiBEdkhIRESMKDBERMaLAEBERIwoMERExosAQEREjCgwRETGiwBARESMKDBERMaLAEBkgX3zxBQsXLuSNN97oHPbnP/+ZmTNn8t///d9erEykdxQYIgMkIiKCvXv38uabb/KHP/yBGzdu8MILL7By5UqWLVvm7fJE7pgeDSIywF555RXy8vKYNWsW+fn5HD16tPMP9IgMJwoMkQHW0tLCunXrKC8v55e//KX+GI8MWzokJTLA7HY7lZWVWCwWrl275u1yRHpNPQyRAdTa2spjjz3G2LFjmTJlCm+88Qbvvvsu8fHx3i5N5I6phyEygPbv388XX3zBzp07eeyxx7j33nt58cUXcbvd3i5N5I4pMEQGyIULF3jrrbf4yU9+QmhoKBaLhb179/Lpp5/yi1/8wtvlidwxHZISEREj6mGIiIgRBYaIiBhRYIiIiBEFhoiIGFFgiIiIEQWGiIgYUWCIiIgRBYaIiBj5/2HI+c5bGlZ3AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as mp\n",
    "X = np.array(arr3_)\n",
    "Y = np.array(arr4_)\n",
    "mp.figure('Bar'  , facecolor='lightgray')\n",
    "mp.title('U(0,3)', fontsize=20)\n",
    "mp.xlabel('x', fontsize=14)\n",
    "mp.ylabel('y', fontsize=14)\n",
    "mp.tick_params(labelsize=10)\n",
    "mp.grid(axis='y', linestyle=':')\n",
    "mp.ylim((0, (top//10+1)*10))\n",
    "x = np.arange(min1,max1)\n",
    "mp.bar(x-0.3, X, 0.6, color='dodgerblue',label='1')\n",
    "mp.bar(x + 0.3, Y, 0.6, color='orangered',label='2', alpha=0.75)\n",
    "mp.xticks(x, [str(i) for i in range(min1,max1)])\n",
    "mp.legend()\n",
    "mp.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "均匀分布"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [],
   "source": [
    "x1=r.randint(0,4,size=[2,1000])\n",
    "x1.sort()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "emmmmm，这好像还是个左闭右开。。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0, 0, 0, ..., 3, 3, 3],\n",
       "       [0, 0, 0, ..., 3, 3, 3]])"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEfCAYAAABSy/GnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XtU1Ped//HncAdHQAERUQyixAte8BKiRiISxWARLySkG600UdNcjr941sRNjHHTmM0xbfY0rdXdRJI013pMq8a4ZnebH7+amuasiqFjpvS4bJE6RQYI4aIjMMz8/mDllIjxEwQG4utxTs443/l+P5/39zPf4ZXvZb5jsdlsXkRERK7Bz9cFiIjIwKDAEBERIwoMERExosAQEREjCgwRETGiwBARESMKDJF+JCsri6ysrE7TDhw4wOTJkzlw4ICPqhJpF+DrAkR6w+TJkzs99/Pzw2q1kpycTG5uLrm5uVgsFh9V5xsOh4PFixezdOlSnnvuOV+XIwOQAkO+1R588EEA3G43FRUVfPTRR5w4cYLPP/+cLVu2+Lg6M5mZmUyZMoWYmBhflyI3OAWGfKs99NBDnZ6fOnWKgoIC9u7dy5o1axg5cqSPKjM3ePBgBg8e7OsyRHQOQ24s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wer0sWrSI22+/3ddl9Qu6rFZERIzokJSIiBhRYIiIiBEFhoiIGFFgiIiIEQWGiIgYUWCIiIgRBYaIiBhRYIiIiBEFhkgv+eKLL8jIyGD37t0d0/70pz8xY8YM/uM//sOHlYl0jwJDpJcMHTqU7du38/LLL/PZZ59x6dIlNm/ezJ133smiRYt8XZ7IN6Zbg4j0sh07dlBUVMTMmTMpLi7mvffe6/iBHpGBRIEh0staWlpYuXIlFRUVvPnmm/oxHhmwdEhKpJc5HA6qqqqwWCycO3fO1+WIdJv2MER6UWtrK6tWrWL06NFMnjyZ3bt386tf/Yq4uDhflybyjWkPQ6QX7dy5ky+++IKnnnqKVatWMWXKFJ544gk8Ho+vSxP5xhQYIr3k+PHjvPHGG/zTP/0T4eHhWCwWtm/fzp///GdeffVVX5cn8o3pkJSIiBjRHoaIiBhRYIiIiBEFhoiIGFFgiIiIEQWGiIgYUWCIiIgRBYaIiBhRYIiIiJH/D95tJUDgkxF8AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as mp\n",
    "X = np.array([list(x1[0]).count(i) for i in range(0,4)])\n",
    "Y = np.array([list(x1[1]).count(i) for i in range(0,4)])\n",
    "mp.figure('Bar'  , facecolor='lightgray')\n",
    "mp.title('Randint', fontsize=20)\n",
    "mp.xlabel('x', fontsize=14)\n",
    "mp.ylabel('y', fontsize=14)\n",
    "mp.tick_params(labelsize=10)\n",
    "mp.grid(axis='y', linestyle=':')\n",
    "top=max(max(list(apples)),max(list(oranges)))\n",
    "mp.ylim((0,top ))\n",
    "x = np.arange(len(apples))\n",
    "mp.bar(x-0.3, apples, 0.6, color='dodgerblue',label='R1')\n",
    "mp.bar(x + 0.3, oranges, 0.6, color='orangered',label='R2', alpha=0.75)\n",
    "mp.xticks(x, [str(i) for i in range(0,4)])\n",
    "mp.legend()\n",
    "mp.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([80, 30, 70, 20, 50])"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.randint(1,10,size=[5])*10"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "果然这里也可以用，厉害了！\n",
    "\n",
    "-----\n",
    "\n",
    "随机的分界线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr=np.arange(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 4])"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[3:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 1, 2, 3, 4])"
      ]
     },
     "execution_count": 106,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([9, 8, 7, 6, 5, 4, 3, 2, 1, 0])"
      ]
     },
     "execution_count": 108,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[-1::-1]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "切片我还是会的！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr=np.array([np.arange(5),np.arange(5,10),np.arange(10,15)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4],\n",
       "       [ 5,  6,  7,  8,  9],\n",
       "       [10, 11, 12, 13, 14]])"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "不错不错，这个比列表推导式写起来还方便一些~"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 4])"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[0][3:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([3, 4])"
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[0,3:5]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "果然这两种都行，以及果然我还是习惯用`[]`的方式？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 5,  6,  7,  8],\n",
       "       [10, 11, 12, 13]])"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[:3,:4]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "好吧，这种逗号的写法还真是有点神奇的，这个是输出前3行的每行的前4个。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4],\n",
       "       [ 5,  6,  7,  8,  9],\n",
       "       [10, 11, 12, 13, 14]])"
      ]
     },
     "execution_count": 115,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr[:3][:4]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "试了下，果然`[]`也可以！神奇！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 7 13\n"
     ]
    }
   ],
   "source": [
    "print(arr[0,1],arr[1,2],arr[2,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 1  7 13]\n"
     ]
    }
   ],
   "source": [
    "print(arr[(0,1,2),(1,2,3)])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "哦，这个是tuple的对应项分别为行号和列号。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 7 14]\n"
     ]
    }
   ],
   "source": [
    "print(arr[(1,2),(2,4)])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "恩，神奇！但是并没觉得太好用，可能还是不习惯吧。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 5  7  8]\n",
      " [10 12 13]]\n"
     ]
    }
   ],
   "source": [
    "print(arr[1:,(0,2,3)])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "选择某几列的某几项。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 2 12]\n"
     ]
    }
   ],
   "source": [
    "print(arr[(0,2),2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 2 12]\n"
     ]
    }
   ],
   "source": [
    "mask = np.array([1,0,1],dtype=np.bool)\n",
    "print(arr[mask,2])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "mask是代表取第0行和第3行的布尔数组。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[7 2 7]\n"
     ]
    }
   ],
   "source": [
    "print(arr[[1,0,1],2])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "看来数字是不行的。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 2 12]\n"
     ]
    }
   ],
   "source": [
    "print(arr[[True,False,True],2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 2 12]\n"
     ]
    }
   ],
   "source": [
    "print(arr[[bool(i) for i in [1,0,1]],2])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "metadata": {},
   "outputs": [
    {
     "ename": "IndexError",
     "evalue": "boolean index did not match indexed array along dimension 0; dimension is 3 but corresponding boolean dimension is 2",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mIndexError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-136-490421a6fa3b>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marr\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mIndexError\u001b[0m: boolean index did not match indexed array along dimension 0; dimension is 3 but corresponding boolean dimension is 2"
     ]
    }
   ],
   "source": [
    "print(arr[[True,True],2])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "布尔值的数量一定要和二维数组的行数一样多。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 1  2  3]\n",
      " [11 12 13]]\n"
     ]
    }
   ],
   "source": [
    "print(arr[[True,False,True],1:4])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "持从多行选多列哎，太棒了！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15"
      ]
     },
     "execution_count": 149,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(3, 5)"
      ]
     },
     "execution_count": 150,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr.shape=5,3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2],\n",
       "       [ 3,  4,  5],\n",
       "       [ 6,  7,  8],\n",
       "       [ 9, 10, 11],\n",
       "       [12, 13, 14]])"
      ]
     },
     "execution_count": 152,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4],\n",
       "       [ 5,  6,  7,  8,  9],\n",
       "       [10, 11, 12, 13, 14]])"
      ]
     },
     "execution_count": 153,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(3,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 154,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.ndim"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "查看数组维度。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr.shape=15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14])"
      ]
     },
     "execution_count": 156,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 157,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.ndim"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 159,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4],\n",
       "       [ 5,  6,  7,  8,  9],\n",
       "       [10, 11, 12, 13, 14]])"
      ]
     },
     "execution_count": 159,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(3,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 160,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14])"
      ]
     },
     "execution_count": 160,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.ravel()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 161,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2],\n",
       "       [ 3,  4,  5],\n",
       "       [ 6,  7,  8],\n",
       "       [ 9, 10, 11],\n",
       "       [12, 13, 14]])"
      ]
     },
     "execution_count": 161,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(5,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 162,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr.shape=arr.size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 163,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14])"
      ]
     },
     "execution_count": 163,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2],\n",
       "       [ 3,  4,  5],\n",
       "       [ 6,  7,  8],\n",
       "       [ 9, 10, 11],\n",
       "       [12, 13, 14]])"
      ]
     },
     "execution_count": 164,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(5,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 165,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14])"
      ]
     },
     "execution_count": 165,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.flatten()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14])"
      ]
     },
     "execution_count": 166,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.flatten(\"F\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4],\n",
       "       [ 5,  6,  7,  8,  9],\n",
       "       [10, 11, 12, 13, 14]])"
      ]
     },
     "execution_count": 171,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.reshape(3,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14])"
      ]
     },
     "execution_count": 172,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.flatten('F')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "各种平展。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14])"
      ]
     },
     "execution_count": 173,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr.shape=3,5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 175,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3,  4],\n",
       "       [ 5,  6,  7,  8,  9],\n",
       "       [10, 11, 12, 13, 14]])"
      ]
     },
     "execution_count": 175,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 184,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr=arr.flatten('F')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 185,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  5, 10,  1,  6, 11,  2,  7, 12,  3,  8, 13,  4,  9, 14])"
      ]
     },
     "execution_count": 185,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 186,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr=arr.reshape(3,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 187,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  5, 10,  1,  6],\n",
       "       [11,  2,  7, 12,  3],\n",
       "       [ 8, 13,  4,  9, 14]])"
      ]
     },
     "execution_count": 187,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "哦，这个reshape好难用啊，还要让arr接收一下值才可以。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr=np.arange(1,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2, 3, 4, 5])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr1=np.arange(6,11)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 6,  7,  8,  9, 10])"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.hstack((arr,arr1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr2=np.vstack((np.vstack((arr,arr1)),arr1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  2,  3,  4,  5],\n",
       "       [ 6,  7,  8,  9, 10],\n",
       "       [ 6,  7,  8,  9, 10]])"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "果然纵向可以玩的随意一点。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr1=np.arange(6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[array([0, 1, 2]), array([3, 4, 5])]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.hsplit(arr1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "vsplit only works on arrays of 2 or more dimensions",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-27-d04678be6c0b>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvsplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marr1\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32mD:\\Anaconda\\lib\\site-packages\\numpy\\lib\\shape_base.py\u001b[0m in \u001b[0;36mvsplit\u001b[1;34m(ary, indices_or_sections)\u001b[0m\n\u001b[0;32m    969\u001b[0m     \"\"\"\n\u001b[0;32m    970\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0m_nx\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mndim\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mary\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m<\u001b[0m \u001b[1;36m2\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 971\u001b[1;33m         \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'vsplit only works on arrays of 2 or more dimensions'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    972\u001b[0m     \u001b[1;32mreturn\u001b[0m \u001b[0msplit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mary\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindices_or_sections\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    973\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mValueError\u001b[0m: vsplit only works on arrays of 2 or more dimensions"
     ]
    }
   ],
   "source": [
    "np.vsplit(arr1,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "一维数组好像是不能纵向分割的。横向分割也必须能整除才可以？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2, 3, 4, 5])"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  2,  3,  4,  5],\n",
       "       [ 6,  7,  8,  9, 10],\n",
       "       [ 6,  7,  8,  9, 10]])"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "arr2=np.vstack((arr2,arr))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1,  2,  3,  4,  5],\n",
       "       [ 6,  7,  8,  9, 10],\n",
       "       [ 6,  7,  8,  9, 10],\n",
       "       [ 1,  2,  3,  4,  5]])"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[array([[ 1,  2,  3,  4,  5],\n",
       "        [ 6,  7,  8,  9, 10]]), array([[ 6,  7,  8,  9, 10],\n",
       "        [ 1,  2,  3,  4,  5]])]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.vsplit(arr2,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[array([[1, 2, 3, 4, 5]]),\n",
       " array([[ 6,  7,  8,  9, 10]]),\n",
       " array([[ 6,  7,  8,  9, 10]]),\n",
       " array([[1, 2, 3, 4, 5]])]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.vsplit(arr2,4)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
